import request from '@/utils/request'

// 获取警情列表
export const getAlerts = (
  current = 1,
  size = 10,
  alertType = null,
  status = null,
  alertNo = null,
  startTime = null,
  endTime = null
) =>
  request.get('/alerts', {
    params: {
      current,
      size,
      alertType,
      status,
      alertNo,
      startTime,
      endTime
    }
  })

// 实时报警信息
export const reportAlert = () => request.get('/alerts/dashboard')

// 获取警情详情
export const getAlertDetail = (id) => request.get(`/alerts/${id}`)

// 获取警情统计信息
export const getAlertStatistics = () => request.get('/alerts/statistics')

// 获取警情分类统计
export const getAlertTypeStats = () => request.get('/alerts/stats')

// 获取警情类型分布（饼图数据）
export const getAlertTypeDistribution = (timeRange = 'month') =>
  request.get('/alerts/distribution', {
    params: { timeRange }
  })

// 获取警情趋势分析
export const getAlertTrend = (alertType) =>
  request.get('/alerts/trend', {
    params: { alertType }
  })

// 机器人分配任务
export const dispatchAlert = (data) => request.post('/alerts/dispatch', data)
// 机器人完成任务
export const completeAlert = (id) => request.put(`/alerts/${id}/complete`)
export const getAlertStat = () => request.get('/alerts/summary')
export const getAlertStatTrend = () => request.get('/alerts/stat-trend')
